package cn.kgc.biz.controller;


import cn.kgc.biz.service.CommentService;
import cn.kgc.vo.CommentPageVo;
import cn.kgc.dto.Dto;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/comment/")
public class CommentController {
    @Resource
    private CommentService commentService;
    @GetMapping("gethotelscore/{hotelId}")
    public Dto getHotelScore(@PathVariable("hotelId") String hotelId){
        return commentService.getHotelScore(Long.parseLong(hotelId));
    }
    @GetMapping("getcount/{hotelId}")
    public Dto getCount(@PathVariable("hotelId") String hotelId){
        return commentService.getCount(Long.parseLong(hotelId));
    }
    @PostMapping("getcommentlist")
    public Dto getCommentList(@RequestBody CommentPageVo commentPageVo){
        return commentService.getCommentList(commentPageVo);
    }
    @GetMapping("getimg/{commentId}")
    public Dto getImg(@PathVariable("commentId") String commentId){
        return commentService.gettImg(Long.parseLong(commentId));
    }
}
